<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<title>追加评价</title>
		<%@include file="../common/rootPath.jsp" %>
		<link rel="stylesheet" type="text/css" href="${ctx}/css/reset.css" />
		<link rel="stylesheet" href="${ctx}/css/public.css" />
		<link rel="stylesheet" type="text/css" href="${ctx}/css/body.css" />
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
		<script type="text/javascript" src="${ctx}/js/jianrong.js"></script>
		<script type="text/javascript" src="${ctx}/js/fastclick.js"></script>
		<script type="text/javascript">
			$(function(){
				//追评
				$('.add-evaluate div').keydown(function(){
					if($(this).text() == "追加评论内容..."){
						$(this).text('');
					}
				});
				$('.add-evaluate div').blur(function(){
					if($(this).text()==''){
						$(this).text('追加评论内容...');
					}
				});
			});
			
			/***提交追加评论***************/
			function addEvaluate(){
				var orderId = $("#orderId").val();
				var productId = $("#productId").val();
				var commentId = $("#commentId").val();
				var consultContent = $("#consultContent").text();
			
				$.ajax({
					url : "${ctx}/consultComment/addCommont",
					type : "POST",
					data :{"orderId":orderId,"goodsId":productId,
						   "commentId":commentId,"consultContent":consultContent
					},
					success:function(data){
						if(data.resultSuccess == true){
							window.location.href='${ctx}/order/myOrders?queryStatus=4';
			    		 	alert("评价商品成功")
			    		}else if(data.resultSuccess == false){
			    		    alert("评价商品失败")
			    		}
					},
					error : function(data, status, e){ 
				    	 alert("发表评价失败"+e);
				  	    // layer.msg('图片上传失败！',{offset: ['40%', '40%'],/*title: ['提醒', 'font-size:18px;'],*/icon:2,time:2000});
				      } 
				});
			
			}
		</script>
	
	</head>
	<body>
		<header>
			<nav class="headerTwo">
				<img src="${ctx}/image/bg.png" alt="" />
				<a href="javascript:history.back(-1)" class="fl"><img src="${ctx}/image/return.png" alt="" /></a>
				<h2>追加评价</h2>
				<a href="javascript:void(0);" onclick="addEvaluate();" class="headerR"><span>发布</span></a>
			</nav>
		</header>
		<div class="pay"></div>
		<input type="hidden" name="orderId" id="orderId" value="${orderId}">
		<input type="hidden" name="productId" id="productId" value="${products[0].productId}">
		<input type="hidden" name="commentId" id="commentId" value="${products[0].commentList[0].id}">
		
		
		<div class="myevaluate addEv">
			<img src="${products[0].picture}" alt="" />
			<!-- <span>已好评</span> -->
			<span class="goods-info">${products[0].productName }</span>
			<p class="evaluate-content wordO">${products[0].commentList[0].consultContent}</p>
			<p class="time"><fmt:formatDate value="${products[0].commentList[0].createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></p>
			
		</div>
		<p class="jiange"></p>
		<div class="add-evaluate">
			<span>追加评价</span>
			<div contenteditable="true" id="consultContent">追加评论内容...</div>
		</div>
		<script type="text/javascript" src="${ctx}/js/jquery.uploadView.js"></script>
		<script type="text/javascript" src="${ctx}/js/public.js"></script>
		<%-- <script type="text/javascript" src="${ctx}/js/up.js"></script> --%>
	</body>
</html>
